package model;

import view.*;
import java.util.*;

/**
 * The abstract class AbstractModel
 * @author Arjan Frans, Alwin Rombout, Jelte Verbree, Brendan Kanters
 * @version 1.0
 */
public abstract class AbstractModel {
        protected List<AbstractView> views;
        
        /**
         * Constructor to create a new AbstractmModel
         */
        public AbstractModel() {
                views=new ArrayList<AbstractView>();
        }
        
        /**
         * Method to add a new view
         * @param view
         */
        public void addView(AbstractView view) {
                views.add(view);
        }
        
        /**
         * Methode to remove all views
         */
        public void removeViews()
        {
        	views.clear();
        }
        
        /**
         * Method to update all views
         */
        public void notifyViews() {
                for(AbstractView v: views) v.updateView();
        }
        
        /**
         * Method to empty all views
         */
        public void clearViews() {
        	for(AbstractView v: views) v.clearView();
        }
}
